package com.deer.wms.ASN.manage.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.deer.wms.ASN.manage.dao.AsnDetailMapper;
import com.deer.wms.ASN.manage.model.asn.AsnDetail;
import com.deer.wms.ASN.manage.model.asn.AsnDetailCriteria;
import com.deer.wms.ASN.manage.model.asn.AsnDetailDto;
import com.deer.wms.ASN.manage.model.asn.AsnMasterCriteria;
import com.deer.wms.ASN.manage.service.AsnDetailService;
import com.deer.wms.project.root.service.SuperServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 *
 * @author guo
 * @since 2020/01/03
 */
@Service
@Transactional
public class AsnDetailServiceImpl extends SuperServiceImpl<AsnDetailMapper, AsnDetail> implements AsnDetailService {

    @Autowired
    private AsnDetailMapper asnDetailMapper;

    @Override
    public List<AsnDetailDto> findList(AsnDetailCriteria criteria) {
        return asnDetailMapper.findList(criteria);
    }

    @Override
    public void deleteByBillNo(String billNo){
        asnDetailMapper.deleteByBillNo(billNo);
    }

    @Override
    public List<AsnDetail>findByBillNo(String billNo){
        return asnDetailMapper.findByBillNo(billNo);

    }

    @Override
    public List<AsnDetailDto> findByDetailNo(String detailNo){
        return asnDetailMapper.findByDetailNo(detailNo);

    }

    @Override
    public AsnDetail findBy(String field, String value) {
        QueryWrapper<AsnDetail> qw = new QueryWrapper<>();
        return getOne(qw.eq(field, value));
    }

    @Override
    public AsnDetail findByInventoryId(Integer inventoryId) {
        return asnDetailMapper.findByInventoryId(inventoryId);
    }

    @Override
    public List<AsnDetail> selectListByType(AsnMasterCriteria criteria) {
        return asnDetailMapper.selectListByType(criteria);
    }
}
